package com.ruoyi.merchant.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 流水类型枚举
 */
@Getter
@AllArgsConstructor
public enum FlowTypeEnum {
    
    INCOME(1, "收入"),
    EXPENSE(2, "支出");
    
    private final Integer code;
    private final String desc;
    
    public static String getDescByCode(Integer code) {
        if (code == null) {
            return "";
        }
        for (FlowTypeEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type.getDesc();
            }
        }
        return "";
    }
}
